package com.lagou.rpc.consumer.client;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;

public class ZkClient {

    public static String PATH = "/provider";
    
    private CuratorFramework client;

    public CuratorFramework getCuratorClient() {
        RetryPolicy exponentialBackoffRetry = new ExponentialBackoffRetry(1000, 3);
        CuratorFramework curatorClient = CuratorFrameworkFactory.builder()
                .connectString("192.168.204.128:2181")
                .sessionTimeoutMs(5000)
                .connectionTimeoutMs(3000)
                .retryPolicy(exponentialBackoffRetry)
                .namespace("base")
                .build();
        curatorClient.start();
        return curatorClient;
    }

}
